const express = require('express')
const app = express()
const cookieParser = require('cookie-parser')

// 链接数据库
require('./middle/mongoose')

app.use(express.json())
app.use(express.urlencoded({ extended: false }))
app.use(express.static('./dist'))
// cookie 解析
app.use(cookieParser())
// session中间件的使用 
app.use(require('./middle/session'))

require('./addData')

app.use('/', require('./router'))

app.listen(5252, () => console.log(`http://localhost:5252`)) 